<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>运营专题明细管理</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
		$(document).ready(function() {
				
		});
		function page(n,s){
			$("#pageNo").val(n);
			$("#pageSize").val(s);
			$("#searchForm").submit();
	    	return false;
	    }
		
		var check_val = [];
		//全选
		function selectAll(n){
			
			if(n.checked){
				check_val = []
				$("input[type=checkbox]").each(function(i,n) {
					if(i>0){
						this.checked = true; 
				        check_val.push(n.value)
					}
		        });  
			}else{
				$("input[type=checkbox]").each(function(i,n) {  
		            this.checked = false; 
		            check_val = []
		        });
			}
		}
		
		//单选
		function check(n){
		
			if(n.checked){
				check_val.push(n.value)
			}else{
				check_val.splice($.inArray(n.value,check_val),1)
			}
		}
		
		function batchAdd(){
			
			if(check_val==null||check_val ==''||check_val==undefined){
				alertx("请选中添加内容信息");
				return false;
			}
			
			var opesubId = $("#opesubId").val();
			
			$.post('${ctx}/mer/operationSubjectDetail/insertOperaSubDtl',
							{'id':check_val+'','opesubId':opesubId},function(result){
							alertx(result.msg);	
			});
			
		}
		
	</script>
</head>
<body>
	<ul class="nav nav-tabs">
		<li><a href="${ctx}/mer/operationSubjectDetail/list?opesubId=${operationContent.opesubId}&opeSubtitle=${operationContent.opeSubtitle}">专题内容维护列表</a></li>
		<li class="active"><a href="${ctx}/mer/operationContent/operationSubDtlList?opesubId=${operationContent.opesubId}&opeSubtitle=${operationContent.opeSubtitle}">专题内容维护添加</a></li>
	</ul><br/>
	<form:form id="searchForm" modelAttribute="operationContent" action="${ctx}/mer/operationContent/operationSubDtlList?opesubId=${operationContent.opesubId}&opeSubtitle=${operationContent.opeSubtitle}" method="post" class="breadcrumb form-search">
		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
		<ul class="ul-form">
			<li><label>标题：</label>
				<form:input path="title" htmlEscape="false" maxlength="64" class="input-medium"/>
			</li>
			<form:input path="opesubId" htmlEscape="false" maxlength="255" class="input-medium" style="display:none"/>
			<%-- <form:input path="opeSubtitle" htmlEscape="false" maxlength="255" class="input-medium" style="display:none"/> --%>
			<li class="btns"><input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/></li>
			<li class="clearfix"></li>
		</ul>
		</br>
		<ul class="ul-form">
			<shiro:hasPermission name="mer:operationContent:edit">
				<li class="btns"><input id="btnBatchAdd" class="btn btn-primary" type="button" onclick="batchAdd()" value="添加"/></li>
			</shiro:hasPermission>
			<li class="clearfix"></li>
		</ul>
	</form:form>
	<sys:message content="${message}"/>
	<table id="contentTable" class="table table-striped table-bordered table-condensed">
		<thead>
			<tr>
				<th><input type="checkbox" name="ck" onclick="selectAll(this)"></th>
				<th>标题</th>
				<th>图片</th>
				<th>更新时间</th>
			</tr>
		</thead>
		<tbody>
		<c:forEach items="${page.list}" var="operationContent">
			<tr>
				<td>
					<input type="checkbox" value ="${operationContent.id }" onclick="check(this)">
				</td>
				<td>
					${operationContent.title}
				</td>
				<td style="width:60px;height:60px">
					<img alt="" src="${operationContent.photo}">	
				</td>
				<td>
					<fmt:formatDate value="${operationContent.updateDate}" pattern="yyyy-MM-dd HH:mm:ss"/>
				</td>
			</tr>
		</c:forEach>
		</tbody>
	</table>
	<div class="pagination">${page}</div>
</body>
</html>